﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using Manager.App_Code;
using System.Linq;
using Manager.Common;

namespace Manager.FormAdd_Edit
{
    public partial class frm_ThemDichVu : DevExpress.XtraEditors.XtraForm
    {
        DichVu dichVu;
        public int SoLuong = 0;
        public frm_ThemDichVu(DichVu _dichVu)
        {
            InitializeComponent();
            dichVu = _dichVu;
        }

        private void btnThem_Click(object sender, EventArgs e)
        {
            SoLuong = CommonFunction.ParseInt(txtSoLuong.Text);
            this.Close();
        }

        private void btnDong_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void txtSoLuong_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!Char.IsDigit(e.KeyChar) && !Char.IsControl(e.KeyChar))
            {
                e.Handled = true;
            }
        }

        private void frm_ThemDichVu_Load(object sender, EventArgs e)
        {
            if (dichVu != null)
            {
                lblTenDichVu.Text = dichVu.TenDichVu;
                lblGia.Text = CommonFunction.AddSeparator(dichVu.GiaDV.Value);
            }
        }
    }
}